function onComplete(text, xml)
{
  if(text.substr(0, 5) == "error"){
    arr = text.split("\n");
    if(arr.length != 2){
      alert("Nieprawidowa odpowied serwera.");
    }
    else{
      alert(arr[1]);
    }
  }
  else{
    location.href = text;
  }
}